<h1 class='text-info'>Serviço</h1>

<?php
switch ($_GET['msg']) {
    case 1: echo "<script>alert('Servico adicionado com sucesso!!!!');</script>"; break;
    case 2: echo "<script>alert('Servico modificado com sucesso!!!!');</script>"; break;
}
?>

<a href="?s=cservico&adicionar" class="btn btn-sm btn-primary" title="Adicionar servico"><i class="glyphicon glyphicon-plus"></i> Adicionar novo servico</a><br/><br/>
<table class="table table-striped table-hover">
    <tr>
        <th>Nome</th>
        <th>Descricao</th>
        <th>Preco Inicial</th>
        <th>Desconto</th>
        <th>Promoção</th>
        <th>Opções</th>
    </tr>
    <?php foreach ($lista as $ele) { ?>
        <tr>
            <td><?= $ele['nome'] ?></td>
            <td><?= $ele['descricao'] ?></td>
            <td><?= $ele['precobase'] ?></td>
            <td>(<?= $ele['desconto'] ?>)%</td>
            <td><?= ($ele['isPromocao'] == 0 ? "Não" : "Sim") ?></td>
            <td>
                <a href="?s=cservico&edit=<?= $ele['idservico'] ?>" class="btn btn-xs btn-warning" title="editar servico"><i class="glyphicon glyphicon-edit"></i></a>
                <a href="?s=cservico&del=<?= $ele['idservico'] ?>" class="btn btn-xs btn-danger" title="excluir servico"><i class="glyphicon glyphicon-trash"></i></a>
            </td>
        </tr>
    <?php } ?>
</table>   